#pragma once

#include "stdafx.h"
#include "GbrHttpBase.h"

class CGbrHttpReqResp :
	public CGbrHttpBase
{
public:
	CGbrHttpReqResp(void);
	~CGbrHttpReqResp(void);
	bool CrackParameters(wchar_t *pParameters);
	void AddKnownHeader(HTTP_HEADER_ID HeaderId, PSTR RawValue);
	DWORD SendDirect(const USHORT StatusCode, PCSTR pReason, PCSTR str);
	DWORD SendOutput();
	class CParameters
	{
	public:
		CParameters(char *sUri);
		wchar_t *Apply(char *sUri);
		wchar_t *All();
		wchar_t *First();
		wchar_t *Next();
		wchar_t *Current();
		size_t lMaxParamCount;
	protected:
		wchar_t * sCurrentParameter;
		size_t lCurrentParameter;
		wchar_t * sAllParameters;
		size_t lAllParameters;
		size_t lAllParametersAllocatedBytes;
	};
	CParameters Parameters;
protected:
	HTTP_RESPONSE httpResponse;
	HTTP_REQUEST httpRequest;
	HANDLE hReqQueue;
	size_t lOutput ;
	char * pOutput ;
	size_t lAllocatedForOutput ;
	void AppendToOutput(const char* s, size_t l);
	void AppendToOutput(const wchar_t* s, size_t l);
	void AppendToOutput(long x);
};

